#include "Comm.hpp"

//这边是发送信息
int main()
{
    int wrd = open(NAMED_PIPE,O_WRONLY);
    if(wrd<0) exit(-1);
    char buffer[1024];
    while(true)
    {
        cout<<"Please say# ";
        fgets(buffer,sizeof(buffer),stdin);  //先往字符串写入字符
        if(strlen(buffer)>0) buffer[strlen(buffer)-1]=0;   //把最后一个字符改成/0
        ssize_t n =write(wrd,buffer,strlen(buffer));
        assert(n==strlen(buffer));
        (void)n;
    }
    close(wrd);
    return 0;
}